package panels;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;
import org.apache.wicket.model.Model;

@SuppressWarnings({ "serial", "rawtypes" })
public class MyAjaxLink extends AjaxFallbackLink  {

	private MyPanel panel;
	
	public MyAjaxLink(String id) {
		super(id);
	}
	
	public MyAjaxLink(String id,MyPanel panel) {
		super(id);
		this.panel = panel;
	}
	
    public MyAjaxLink(final String id, final BodyPanel body,String name) {
        super(id);
        this.setPanel(body);
        this.setBody(Model.of(name));
    }

	/**
	 * Cambia el menu o el cuerpo de la pagina
	 */
	@Override
	public void onClick(AjaxRequestTarget target) {
		this.panel.changePanel(target);
		//this.panel.getHome().changeBodyPage((BodyPanel)this.panel, target);
	}


	public MyPanel getPanel() {
		return panel;
	}

	public void setPanel(MyPanel panel) {
		this.panel = panel;
	}

}
